package entity.lemming;


import entity.lemming.Walker;
import junit.framework.TestCase;

/**
 * Test for the walker class, test the methods of the walker and
 * ensure the expected results.
 * 
 * @author Neil Cowzer
 */
public class WalkerTest extends TestCase {

	private Walker lemming;
	private int old_x;
	
	protected void setUp(){
		lemming = new Walker(0, 0);
	}
	
	protected void tearDown(){
		lemming = null;
		old_x = 0;
	}
	
	/** Test the move method */
	public void testmove(){
		for (int i = 0; i < 200; i++){
			if (Math.random() < .2){
				lemming.turnAround();
				System.out.println("turnAround");
			}
			
			old_x = lemming.getX();
			
			lemming.move();
			
			
			// Provide the assertions
			assertEquals(old_x, (lemming.getX() - lemming.getSpeed_X()));
			assertTrue(lemming.getSpeed_X() == 1 || lemming.getSpeed_X() == -1);
			assertTrue(lemming.getSpeed_Y() == 0);
		}
	}
	
	
	
}
